﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.guysherman.simulclass
{
    public static class MemberInfoExtensions
    {
        public static MemberVisibility Visibility(this System.Reflection.FieldInfo fieldInfo)
        {
            if (fieldInfo.IsPublic)
            {
                return MemberVisibility.Public;
            }
            else if (fieldInfo.IsPrivate)
            {
                return MemberVisibility.Private;
            }
            else if (fieldInfo.IsFamily)
            {
                return MemberVisibility.Protected;
            }
            else if (fieldInfo.IsAssembly)
            {
                return MemberVisibility.Internal;
            }
            else
            {
                return MemberVisibility.Private;
            }
        }

        public static MemberVisibility Visibility(this System.Reflection.MethodInfo methodInfo)
        {
            if (methodInfo.IsPublic)
            {
                return MemberVisibility.Public;
            }
            else if (methodInfo.IsPrivate)
            {
                return MemberVisibility.Private;
            }
            else if (methodInfo.IsFamily)
            {
                return MemberVisibility.Protected;
            }
            else if (methodInfo.IsAssembly)
            {
                return MemberVisibility.Internal;
            }
            else
            {
                return MemberVisibility.Private;
            }
        }

       
    }
}
